import pandas as pd
data=pd.read_csv('dis.csv')
src=list(data['src'])
dis=list(data['dst'])

dic={}
for i in range(len(src)):
    if src[i] not in dic:
        dic[src[i]]=len(dic)
for i in range(len(dis)):
    if dis[i] not in dic:
        dic[dis[i]]=len(dic)

import requests
def geocode(address):
    parameters = {'address': address, 'key': '5fc997b0e717d9a10d477d1e462efe5d'}
    base = 'http://restapi.amap.com/v3/geocode/geo'
    response = requests.get(base, parameters)
    answer = response.json()
    location = answer['geocodes'][0]['location'].split(',')
    return location

keys=dic.keys()
dic2={}
place=[]
for i in keys:
    try:
        dic2[i]=geocode(i)
    except:
        print(i)

dic2['扶余']=['126.042758','44.986199']
dic2['介休']=['111.905576','37.024684']
dic2['宁强']=['105.6','32.8']
dic2['冕宁']=['102.09','28.39']
dic2['万源']=['108.06','32.07']
dic2['华蓥']=['106.768000','30.354750']
dic2['呼和浩特市']=['111.749180','40.842585']
dic2['杭锦']=['108.72934','39.84023']
dic2['玉屏']=['108.917882','27.238024']
dic2['靖边']=['108.79412','37.59938']
dic2['鄂托克旗']=['107.976161','39.089650']
dic2['福鼎']=['120.21664','27.3243']
dic2['郁南']=['111.53387','23.23307']
dic2['桂平']=['110.08105','23.39339']
dic2['祁东']=['112.09039','26.79964']
dic2['宾阳']=['108.81185','23.2196']
dic2['武穴']=['115.55975','29.84446']
dic2['九龙']=['114.17495','22.327115']
